<%--
  Created by IntelliJ IDEA.
  User: 兰宦君
  Date: 2015/10/8
  Time: 20:17
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<html>
<head>
  <title>后台管理系统——订单管理</title>
  <%@ include file="../../layout/import.jsp"%>
  <script type="text/javascript">
    function sendOrder(orderid) {
      $.ajax({
        url: "/admin/delOrder.do",
        data: {id:orderid},
        method: "POST",
        dataType: "json",
        error: function () {
          alert("表单提交出错，请稍后再试");
        },
        success: function(response) {
          if(response.code == 0) {
            window.location.href = "/admin/order.do";
          }
          else {
            alert(response.description);
          }
        }
      });
    }
  </script>
</head>
<body>
<%@ include file="nav.jsp"%>

<div class="container" style="min-height: 72%">
  <div class="col-sm-12">
    <table class="table table-hover">
      <tr>
        <th>日期</th><th>付款方式</th><th>送货方式</th><th>收货人</th>
        <th>地址</th><th>电话</th><th>邮编</th><th>总价</th><th>状态</th><th>操作</th>
      </tr>

      <c:forEach var="order" items="${orderList}">
        <tr>
          <td>${order.date}</td>
          <td>${order.payment}</td>
          <td>${order.deliver}</td>
          <td>${order.receiver}</td>
          <td>${order.address}</td>
          <td>${order.phone}</td>
          <td>${order.postcode}</td>
          <td>${order.totalprice}</td>
          <td>
            <c:if test="${order.state == '已发货'}">已发货</c:if>
            <c:if test="${order.state == '未处理'}">未处理</c:if>
            <c:if test="${order.state == '完毕'}">完毕</c:if>
          </td>
          <td>
              <a href="orderInfo.do?id=${order.id}">订单详情</a>
          </td>
        </tr>
      </c:forEach>

    </table>

    <nav>
      <ul class="pagination">
        <!--
                <li <c:if test="${thisPage eq 1}">class="disabled"</c:if> >
                    <a href="/admin/book.do?page=${thisPage - 1}" aria-label="Previous">
                        <span aria-hidden="true">&laquo;</span>
                    </a>
                </li>
                -->
        <c:forEach var="page" begin="1" end="${totalPage}" step="1" >
          <li <c:if test="${thisPage eq page}">class="active"</c:if> ><a href="/admin/order.do?page=${page}" > ${page}</a></li>
        </c:forEach>
        <!--
                <li <c:if test="${thisPage eq totalPage}">class="disabled"</c:if>>
                    <a href="/admin/book.do?page=${thisPage + 1}" aria-label="Next">
                        <span aria-hidden="true">&raquo;</span>
                    </a>
                </li>
                -->
      </ul>
    </nav>

  </div>

</div>


<%@ include file="../footer.jsp"%>
</body>
</html>
